package com.example.mobile2030606150cjk0402;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageSwitcher;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private ImageView lvMainLv;
    private Button btnMainBt;
    int i = 0;
    int[] image = {R.drawable.line01,R.drawable.line02,R.drawable.line03,R.drawable.line04,R.drawable.line05,R.drawable.line06};


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        lvMainLv = (ImageView) findViewById(R.id.lv_main_lv);
        btnMainBt = (Button) findViewById(R.id.btn_main_bt);
        btnMainBt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(i >= 5){
                    i = -1;
                }
                lvMainLv.setImageResource(image[++i]);
            }
        });
    }
}